//
//  YFGlobalMacro.h
//  YFToolsDemo
//
//  Created by apple on 2018/4/26.
//  Copyright © 2018年 BigShow. All rights reserved.
//

#import <Foundation/Foundation.h>

/******************************  全局宏  *********************************/


@interface YFGlobalMacro : NSObject

#pragma mark - 颜色
// 可以在项目中的全局文件里写这些
#define YFColor_Red [UIColor colorWithHexString:@"ff3400"]
#define YFColor_Background [UIColor colorWithHexString:@"f5f5f5"]
#define YFColor_Text [UIColor colorWithHexString:@"333333"]

//16进制color
#define HexRGB(rgbValue)    [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define HexRGBA(rgbValue,a) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:(a)]
//RGB色值
#define RGB(r,g,b)  [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1]
#define RGBA(r,g,b,a)  [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)]

#pragma mark - 系统版本
//获取当前系统版本
#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]

#define IS_iOS8Later (IOS_VERSION >= 8.0)
#define IS_iOS9Later (IOS_VERSION >= 9.0)
#define IS_iOS10Later (IOS_VERSION >= 10.0)
#define IS_iOS11Later (IOS_VERSION >= 11.0)

#define IS_IOS8 (IOS_VERSION == 8.0)
#define IS_IOS9 (IOS_VERSION == 9.0)
#define IS_IOS10 (IOS_VERSION == 10.0)
#define IS_IOS11 (IOS_VERSION == 11.0)


#pragma mark - 设备型号
#define iPhone4 ([UIScreen mainScreen].bounds.size.height == 480)
// 或者 se 5c
#define iPhone5 ([UIScreen mainScreen].bounds.size.height == 568)
// 或者iPhone7,iPhone8
#define iPhone6 ([UIScreen mainScreen].bounds.size.height == 667)
// 或者iPhone7P,iPhone8P
#define iPhone6P ([UIScreen mainScreen].bounds.size.height == 736)
#define iPhoneX ([UIScreen mainScreen].bounds.size.height == 812)
#define isLargeriPhone6 ([UIScreen mainScreen].bounds.size.height > 667)


#pragma mark - 物理屏幕尺寸
#define Height_TabBar (iPhoneX ? 83.f : 49.f)
#define Height_NavContentBar 44.0f
#define Height_StatusBar (iPhoneX ? 44.0f: 20.0f)
#define Height_NavBar (iPhoneX ? 88.0f: 64.0f)

#define UISCREEN_WIDTH   [UIScreen mainScreen].bounds.size.width
#define UISCREEN_HEIGHT  [UIScreen mainScreen].bounds.size.height


#pragma mark - 其他调试
// 自定义Log
#ifdef DEBUG // 调试
#define MyLog(yyy, ...) NSLog(@"%s(%d): " yyy, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#else // 发布打包
#define MyLog(...)
#endif


//是否为真机运行
#if TARGET_IPHONE_SIMULATOR
//模拟器运行
#else
//真机运行 TARGET_OS_IPHONE
#endif


#define kWeakSelf typeof(self) __weak weakSelf = self;
#define ARRAY_INIT(NAME) - (NSMutableArray *)NAME { \
if (_##NAME == nil) { \
_##NAME = [[NSMutableArray alloc] init]; \
} \
return _##NAME; \
}
@end
